<%--@ page language="java" contentType="text/html; charset=ISO-8859-1" --%>

<%@ page import="uk.ac.sanger.*" %>

<jsp:include  page="header.jsp"></jsp:include>

<html>

<body>
 
 		<% String id = request.getParameter("id");
   		   String system_uri =request.getParameter("uri");
 		%>
 		
<div id="table">

<table>
	<tr  id="row0">
	    <th>ACTION</th>
	    <th>USER</th>
	    <th>DATE</th>
	    <th>MESSAGE</th>
		<th>FEATUREID</th>
		<th>FEATURETYPE</th>
		<th>METHOD</th>
		<th>SEGMENTID</th>
		<th>START</th>
		<th>END</th>
		<th>STRAND</th>
		<th>PHASE</th>
		<th>SCORE</th>
		<th>ATTRIBUTES</th>
	</tr>
  
    <% //get data from db
    if (request != null) {	
		//first check open id
        if((String)session.getAttribute("openid")==null) 
        {	String message = "you are not logged in, please log in first!";
    		session.setAttribute("message", message);
    		response.sendRedirect("login.jsp");	
        }
    	
        DataManager dbM = new DataManager(); 
   		
   		if (system_uri!=null & !system_uri.equals("")){
  			FeatureBean[] features = dbM.getHistoryById(id,system_uri) ; %>
  			
  			<%//get coordinate system name
   		     String system_name ="";
			 //  system name from DataManager, static variable 
			 system_name = dbM.new_system_name;
			 session.setAttribute("system_name",system_name); %>
 			 <h1>History for : <%= request.getParameter("id")%> </h1>
 			 <h1>Coordinate system : <%=system_name%></h1>
  			 			
  			<%	if(features!=null)
  			{
  					for (int i=0;i<features.length;i++) 
  					{ 
  	  					if (i % 2 != 0) { %>
  	  						<tr id="row1">
  	  						<%	} 
  	  					else 
  	  					{ %>
  	  						<tr id="row2">
  	  		 				<%} %>
  			   				<td><%=features[i].getAction() %></td>
  			   				<td><%=features[i].getUser() %></td>
	  		   				<td><%=features[i].getDate() %></td>
	  		   				<td><%=features[i].getCommitMsg() %>  <BR></td>
		       				<td><%=features[i].getFeatureid() %></td>
	           				<td><%=features[i].getFeaturetype() %></td>
	           				<td><%=features[i].getMethod() %></td>
	           				<td><%=features[i].getSegment() %></td>
	           				<td><%=features[i].getStart()%></td>
	           				<td><%=features[i].getEnd() %></td>
	           				<td><%=features[i].getStrand() %></td>
	           				<td><%=features[i].getPhase() %></td>
	           				<td><%=features[i].getScore() %></td>
	           				<td><%=features[i].getNotes() %></td>
		       				</tr>   	
  		  <% }}}} %>
</table>
</div>
<p>
Back to   <A href="show_features.jsp?action=show&uri=<%= system_uri%>">home</A>. 
</p>

</body>
</html>
<jsp:include  page="footer.jsp"/>